home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / common / hashacct.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  3KB  |  94 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from util.primitives import dictdiff
  5. import cPickle
  6. from traceback import print_exc
  7.  
  8. class HashedAccount(object):
  9.     
  10.     def min_hash(self):
  11.         return ''.join((lambda .0: for c in .0:
  12. str(c))([
  13.             self.id,
  14.             self.protocol,
  15.             self.username]))
  16.  
  17.     
  18.     def total_hash(self):
  19.         if not hasattr(self, 'xml_element_name'):
  20.             data = self.get_options()
  21.         else:
  22.             
  23.             try:
  24.                 if self.data is not None:
  25.                     data = cPickle.loads(self.data)
  26.                     
  27.                     try:
  28.                         d = self.protocol_info()['defaults']
  29.                     except KeyError:
  30.                         d = { }
  31.  
  32.                     data = dictdiff(d, data)
  33.                     import common.protocolmeta as pm
  34.                     if self.protocol in pm.improtocols.keys():
  35.                         for k in data.keys():
  36.                             if k not in d:
  37.                                 data.pop(k)
  38.                                 continue
  39.                         
  40.                     else:
  41.                         
  42.                         try:
  43.                             opts = self.protocol_info()['whitelist_opts']
  44.                         except KeyError:
  45.                             opts = ()
  46.  
  47.                         for k in data.keys():
  48.                             if k not in opts:
  49.                                 data.pop(k)
  50.                                 continue
  51.                         
  52.                 else:
  53.                     data = None
  54.             except Exception:
  55.                 print 'data was: %r' % self.data
  56.                 print_exc()
  57.                 data = None
  58.  
  59.         return (''.join((lambda .0: for c in .0:
  60. str(c))([
  61.             self.id,
  62.             self.protocol,
  63.             self.username,
  64.             self.password])), data)
  65.  
  66.     
  67.     def protocol_info(self, proto = sentinel):
  68.         protocols = protocols
  69.         import common.protocolmeta
  70.         return None[protocols if proto is not sentinel else self.protocol]
  71.  
  72.     
  73.     def _total_hash(self):
  74.         return getattr(self, '_total_hash_', None)
  75.  
  76.     _total_hash = property(_total_hash)
  77.     
  78.     def store_hash(self, hash = sentinel):
  79.         self._total_hash_ = None if hash is not sentinel else self.total_hash()
  80.  
  81.  
  82.  
  83. class HashedAccounts(object):
  84.     
  85.     def calc_hash(self):
  86.         if not hasattr(self, 'xml_element_name'):
  87.             return sorted((lambda .0: for a in .0:
  88. a._total_hash)(self))
  89.         else:
  90.             return dict((lambda .0: for a in .0:
  91. (a.id, a.total_hash()))(self))
  92.  
  93.  
  94.